package com.atguigu.gulimall.order.service;

import com.atguigu.common.exception.NoStockException;
import com.atguigu.common.to.mq.SeckillOrderTo;
import com.atguigu.gulimall.order.entity.OrderItemEntity;
import com.atguigu.gulimall.order.vo.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.atguigu.common.utils.PageUtils;
import com.atguigu.gulimall.order.entity.OrderEntity;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;

/**
 * 订单
 *
 * @author aiyuxun
 * @email 1492454559@qq.com
 * @date 2021-01-19 16:14:27
 */
public interface OrderService extends IService<OrderEntity> {

    PageUtils queryPage(Map<String, Object> params);

    /**
     * 订单确认页返回需要的数据
     * @return
     */
    OrderConfirmVo confirmOrder() throws ExecutionException, InterruptedException;

    SubmitRespVo submitOrder(OrderSubmitVo submitVo) throws NoStockException;

    List<OrderItemEntity> buildOrderItems(String orderSn);

    OrderItemEntity buildOrderItem(OrderItemVo itemVo);

    OrderEntity getOrderByOrderSn(String orderSn);

    void closeOrder(OrderEntity entity);

    PayVo getOrderPay(String orderSn);

    PageUtils queryWithItem(Map<String, Object> params);

    String handlePayResult(PayAsyncVo vo);

    void createSecOrder(SeckillOrderTo seckillOrder);

    void payOrder(String orderSn);
}

